function saveData() {
	var form = baseJs.getForm("addForm");
	if (!form.isVal()) {
		alert("请按要求填写数据！");
		return;
	}
	$.post(host + "moduleAction/saveQueryField.html", form.getItems(), function(data) {
		if (data.status == "ok") {
			baseJs.getOpenWindow().alert(data.msg);
			baseJs.getOpenWindow().querDataGrid.datagrid('reload');
			baseJs.getOpenWindow().dialog.close();
		} else {
			alert(data.msg);
		}
	}, "json");
}
$(function() {
	var id = baseJs.request("id");
	if (id) {
		$("#id").val(id);
		$("#tableName").text(baseJs.request("tableName"));
		$.post(host + "moduleAction/getModuleQueryById.html", {id: id}, function(data) {
			if (data.status == "error") {
				alert(data.msg);
			} else {
				data = data.data;
				for (var key in data) {
					$("#" + key).val(data[key]);
				}
				changeType(data["type"]);
			}
		}, "json");
	}
});
function changeType(value) {
	if (value == "date" || value == "number") {
		$("#isRange").attr("disabled", false);
	} else {
		$("#isRange").val("0");
		$("#isRange").attr("disabled", true);
	}
}
function closeWin() {
	baseJs.getOpenWindow().dialog.close();
}